var express = require('express');

let router = function () {
    this.routerArry = []
    this._router = express.Router();
}

for (const key in express.Router().__proto__) {
    router.prototype[key] = function (...argument) {
        let _object = {
            path: argument[0],
            content: '',
            method: key,
            descri: (val) => {
                _object.content = val
            }
        }

        if (Object.prototype.toString.call(argument[argument.length - 1]).indexOf('String') >= 0) {
            _object.content = argument[argument.length - 1]
            let _argument = []
            for (let i = 0; i < (argument.length - 1); i++) {
                _argument.push(argument[i])
            }
            this._router[key](..._argument)
        }
        else
            this._router[key](...argument)

        this.routerArry.push(_object)
        return _object
    }
}


module.exports = router